﻿using CodeGenerator.Console.ProjectBLService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeGenerator.Console
{
    public class VerifyUserAction : IAction
    {
        public ActionResult Verify(String username, String password)
        {
            LoginDto dto = new LoginDto();
            dto.UserName = username;
            dto.Password = password;

            ProjectBLClient client = new ProjectBLClient();
            try
            {
                ActionResultDtoUserDto dto2 = client.Login(dto);
                ActionResult result = new ActionResult() { Id = dto2.Data.Id, Code = dto2.Data.UserName, Status = dto2.Status };
                return result;
            }
            catch (Exception ex)
            {
                //System.Console.WriteLine(ex);
            }

            return new ActionResult() { Id = -1, Code = "", Status = false };
        }
    }
}
